package com.qyl.deguru.common;

public class PageModel {
	//定义常量：默认情况下，显示5条记录
	public final static int PAGE_SIZE = 5;
	//当前页
	private Integer pageIndex;
	//每页显示记录条数
	private int pageSize;
	//总记录数
	private Integer recordCount;
	
	//获取起始页
	public int getStartRow(){
		return (this.getPageIndex() - 1) * this.getPageSize();
	}
	
	
	//获取总页数
	public int getTotalPage(){
		return (this.getRecordCount() - 1) * this.getPageSize() + 1;
	}
	
	//提供getter and setter方法
	public Integer getPageIndex(){
		return pageIndex>0?pageIndex:1;
	}
	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}
	public int getPageSize(){
		return pageSize>0?pageSize:PAGE_SIZE;
	}
	public void setPageSize(int pageSize){
		this.pageSize = pageSize;
	}
	public Integer getRecordCount(){
		return recordCount;
		
	}
	public void setRecordCount(Integer recordCount){
		this.recordCount = recordCount;
	}
	
}

